/*
 *  Copyright 2006 www.webtair.com
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package com.webtair.session.artifact;

import java.util.Calendar;

/**
 * Class is a basic SessionInfo implementation
 * with min needed fields.
 * 
 * @author Vaclav (Vyacheslav Yakovenko)
 */
public class SimpleSessionInfo implements SessionInfo {
	
	/** Storage of last used session moment */
	private long lastTimeUsed;

	/** 
	 * Default constrctor inti SimpleSessionInfo
	 * and populate lastTimeUsed with current time value
	 */
	public SimpleSessionInfo(){
		//FIXME: 
		//System.currentTimeMillis();
		this(Calendar.getInstance().getTimeInMillis());
	}
	
	/**
	 * Constructor that populate SimpleSessionInfo 
	 * with mentioned time value
	 * @param lastTimeUsed - mentioned time value
	 */
	public SimpleSessionInfo(long lastTimeUsed){
		this.lastTimeUsed = lastTimeUsed;
	}
	
	/**
	 * Return last time of session used in ms
	 */
	public long getLastTimeUsed() {
		return lastTimeUsed;
	}

	/**
	 * Set last time of session used in ms
	 * @param lastTimeUsed - last time when session used, ms
	 */
	public void setLastTimeUsed(long lastTimeUsed) {
		this.lastTimeUsed = lastTimeUsed;
	}
}
